package com.nifostasky.pattern.consumer;

import com.nifostasky.pattern.config.RabbitTopicConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class TopicConsumer {

    @RabbitListener(queues = {RabbitTopicConfig.QUEUE_NAME1, RabbitTopicConfig.QUEUE_NAME2})
    public void topicQueue(Message message){
        log.info(message.toString());
        log.info(new String(message.getBody()));
    }

//    @RabbitListener(queues = {RabbitTopicConfig.QUEUE_NAME2})
//    public void topicQueue1(Message message){
//        log.info(message.toString());
//        log.info(new String(message.getBody()));
//    }
//
//    @RabbitListener(queues = {RabbitTopicConfig.QUEUE_NAME1})
//    public void topicQueue2(Message message){
//        log.info(message.toString());
//        log.info(new String(message.getBody()));
//    }
}
